/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
<template>
    <div v-if="logList && logList.length"  ref="content" class="preview-log__container">
        <div v-for="(item,index) in logList"
            :key="index"
            class="log-item">
            {{ item }}
        </div>
    </div>
    <empty-panel v-else
                :title="_('暂无数据')" />
</template>
<script>
import EmptyPanel from 'src/components/empty_panel.vue';

export default {
    props: {
        logList: {
            type: Array,
            default: () => []
        }
    },
    components: {
        EmptyPanel
    },

    mounted() {
        this.scrollToBottom();
    },
    methods: {
        scrollToBottom() {
            let vm = this;
            vm.$nextTick().then(() => {
                let scrollTarget = this.$refs.content;
                scrollTarget.scrollTop = scrollTarget.scrollHeight;
            })            
        }
    },
};
</script>
<style lang="less">
    .preview-log__container{
        height: 600px;
        width: 360px;
        padding: 15px;
        overflow-y: scroll;
        line-height: 20px;
        border: 1px solid #B2B2B2;
        margin: 20px;

        .log-item {
            width: 320px;
            word-break: break-all;
        }
    }
</style>

